﻿namespace Contoso.ActiveDirectory {

    #region Usings
    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
    using System.Threading.Tasks;
    using System.Xml.Serialization;
    #endregion

    /// <summary>
    /// DS_REPL_ATTR_META_DATA structure
    /// http://msdn.microsoft.com/en-us/library/windows/desktop/ms676248%28v=vs.85%29.aspx
    /// </summary>
    /// <remarks>
    /// Defines the entries for the msDS-ReplValueMetaData attribute.  
    /// </remarks>
    [Serializable]
    [XmlType("DS_REPL_ATTR_META_DATA")]
    public class ReplicationAttributeMetaData {

        /// <summary>
        /// Pointer to a null-terminated Unicode string that contains the LDAP display name of the attribute corresponding to this metadata.
        /// </summary>
        [XmlElement("pszAttributeName")]
        public string PszAttributeName { get; set; }

        /// <summary>
        /// Contains the version of this attribute. Each originating modification of the attribute increases this value by one. Replication of a modification does not affect the version.
        /// </summary>
        [XmlElement("dwVersion")]
        public int DwVersion { get; set; }

        /// <summary>
        /// Contains a FILETIME structure that contains the time at which the last originating change was made to this attribute. Replication of the change does not affect this value.
        /// </summary>
        [XmlElement("ftimeLastOriginatingChange")]
        public DateTime FTimeLastOriginatingChange { get; set; }

        /// <summary>
        /// Contains the invocation identifier of the server on which the last change was made to this attribute. Replication of the change does not affect this value.
        /// </summary>
        [XmlElement("uuidLastOriginatingDsaInvocationID")]
        public Guid UuidLastOriginatingDsaInvocationID { get; set; }

        /// <summary>
        /// Contains the update sequence number (USN) on the originating server at which the last change to this attribute was made. Replication of the change does not affect this value.
        /// </summary>
        [XmlElement("usnOriginatingChange")]
        public long UsnOriginatingChange { get; set; }

        /// <summary>
        /// Contains the USN on the destination server, that is the server from which the DsReplicaGetInfo2 function retrieved the metadata, at which the last change to this attribute was applied. This value is typically different on all servers.
        /// </summary>
        [XmlElement("usnLocalChange")]
        public long UsnLocalChange { get; set; }

    }
}
